home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 22 / macformat_22.iso / Shareware / Programación / The Gray Council 1.1 / source / Core / GrayCouncil.h < prev   
Encoding:
Text File  |  1996-08-08  |  38.5 KB  |  1,150 lines  |  [TEXT/CWIE]

  1. //
  2. // GrayCouncil
  3. // Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
  4. //
  5. // Before using any of the GrayCouncil source code, read and
  6. // follow the licensing info in the accompanying documentation
  7. // or contact:
  8. //   <trygve@kagi.com>
  9. //   <http://www.kagi.com/authors/trygve/>
  10. //
  11. // Classes defined below:
  12. //    AGAObject -- abstract base class for most others
  13. //    MExclusiveObject -- mixin class for mutual exclusivity (e.g. radio)
  14. //    AGATextStyle -- text style attributes container
  15. //    AGAStaticText -- simple string object
  16. //    AGAPushButton -- push button with auto default outline capability
  17. //    AGACheckBox -- check box with mixed state capability
  18. //    AGARadioButton -- radio button with mixed state capability
  19. //    MIconButtonObject -- mixin class for icon buttons
  20. //    AGAIconPushButton -- AGAPushButton subclass for icon push buttons
  21. //    AGAIconCheckBox -- AGACheckBox subclass for on/off icon buttons
  22. //    AGAIconRadioButton -- AGARadioButton subclass for mutually exclusive
  23. //        on/off icon buttons
  24. //    AGATrackingIndicator -- abstract superclass for scroll bar and slider
  25. //    AGAScrollBar -- scroll bar with 32-bit values, live tracking, and
  26. //        proportional indicator capabilities
  27. //    AGASlider -- slider with pointy or rectangular indicator, optional
  28. //        labels, live tracking, proportional indicator capabilities
  29. //    AGAPopupMenu -- popup menu with optional title
  30. //    AGALittleArrows -- little up/down arrows with notification
  31. //    AGADisclosureTriangle -- disclosure triangle with animation
  32. //    AGAProgressIndicator -- determinate or indeterminate progress gauge
  33. //        with moving determinate origin capability
  34. //    AGASeparator -- separator line with automatic directionality
  35. //    AGAGroupBox -- primary or secondary group box with optional title or
  36. //        room for external title or control
  37. //
  38.  
  39. #ifndef __GRAYCOUNCIL__
  40. #define __GRAYCOUNCIL__
  41.  
  42. #define kGrayCouncilCopyright "\pGray Council ©1996 by Trygve Isaacson. All Rights Reserved."
  43.  
  44. #include <stl.h>
  45.  
  46. //
  47. // You must call InitGrayCouncil after initializing the Toolbox
  48. // and before instantiating any GrayCouncil objects. This routine
  49. // is called automatically if you call the framework-specific
  50. // initializer. If it returns an error, you should quit. The only
  51. // current error situation of this is an out-of-memory condition
  52. // during initialization.
  53. //
  54.  
  55. extern OSErr InitGrayCouncil();
  56.  
  57. //
  58. // AGAObject ---------------------------------------------------------------
  59. //
  60. // All of the visual GrayCouncil objects inherit from AGAObject.
  61. //
  62. // In general, all you have to do with any AGAObject is instantiate it,
  63. // and then call its DrawObject() and TrackMouse() functions when needed.
  64. // When calling the drawing and mouse tracking functions (and this includes
  65. // functions where you set an attribute with redraw set to true), you must
  66. // ensure that the GrafPort and coordinate system are correct prior to the
  67. // call.
  68. //
  69. // Public functions:
  70. // - AGAObject. You supply its coordinate boundary.
  71. // - GetObjectBounds. Returns its coordinate boundary.
  72. // - SetObjectBounds. Call this to change its coordinate boundary.
  73. // - DrawObject. Draws the object. Assumes current port, pen normal.
  74. // - ContainsMouse. Returns true if specified mouse would hit it.
  75. // - TrackMouse. Handles a mouse click. Returns true if hit did something.
  76. // - SetEnable. Enables or disables it.
  77. // - SetBackgroundEraseColor. Sets the color the object will use when erasing its background.
  78. //
  79. // You can #define AGA_SUPERCLASS to be TObject or whatever
  80. // if you prefer to have the AGA stuff not be its own root
  81. // class hierarchy.
  82. //
  83.  
  84. class AGAObject
  85.  
  86. #ifdef AGA_SUPERCLASS
  87.     : public AGA_SUPERCLASS
  88. #endif // AGA_SUPERCLASS
  89.  
  90.     {
  91.     public:
  92.  
  93.         AGAObject(Rect* bounds);
  94.         virtual ~AGAObject();
  95.         
  96.         virtual void    GetObjectBounds(Rect* bounds);
  97.         virtual void    SetObjectBounds(Rect* bounds, Boolean redraw);
  98.         virtual void    DrawObject();
  99.         virtual Boolean    ContainsMouse(Point mouseLocation);
  100.         virtual Boolean    TrackMouse(Point mouseLocation);
  101.         virtual void    SetEnable(Boolean isEnabled, Boolean redraw);
  102.         virtual void    SetBackgroundEraseColor(RGBColor* color);
  103.  
  104.         enum { kRedraw = TRUE, kDontRedraw = FALSE };
  105.         enum { kEnabled = TRUE, kDisabled = FALSE };
  106.         enum { kPressed = TRUE, kNotPressed = FALSE };
  107.         enum { kFrameInside = TRUE, kFrameOutside = FALSE };
  108.         enum { kIsDefault = TRUE, kIsNotDefault = FALSE };
  109.         enum { kAutomaticState = TRUE, kNoAutomaticState = FALSE };
  110.         enum { kLiveTracking = TRUE, kNoLiveTracking = FALSE };
  111.         enum { kProportional = TRUE, kNotProportional = FALSE };
  112.         enum { kHorizontal = TRUE, kVertical = FALSE };
  113.         enum { kTrackingIn = TRUE, kTrackingOut = FALSE };
  114.  
  115.     protected:
  116.  
  117.         // HitTest and SetTrackingState are called repeatedly by the default
  118.         // mouse tracker.
  119.         virtual Boolean    HitTest(Point mouseLocation);
  120.         virtual void    SetTrackingState(Boolean isIn);
  121.         
  122.         Rect        mBounds;
  123.         Boolean        mEnabled;
  124.         RGBColor    mBackgroundEraseColor;
  125.     };
  126.  
  127. //
  128. // MExclusiveObject ---------------------------------------------------------------
  129. //
  130. // MExclusiveObject is a mixin class for automatically keeping several
  131. // objects in a group mutually exclusive. The radio button class below
  132. // uses this to allow automatic radio button group behavior. MExclusiveObject
  133. // maintains knowledge of "groups" of objects. When one member of the group is
  134. // "hit", the other members of the group are sent the TurnOff() message. To
  135. // identify each object uniquely, the object has a pair of 32-bit identifiers.
  136. // Typically these can set to the group's ID and GrafPtr. This allows having
  137. // multiple windows that use the same group IDs. If you set the IDs to kNoGroupID,
  138. // then this automatic maintenance is bypassed.
  139. //
  140.  
  141. class MExclusiveObject
  142.     {
  143.     public:
  144.  
  145.         MExclusiveObject(UInt32 groupIDPart1, UInt32 groupIDPart2);
  146.         virtual ~MExclusiveObject();
  147.  
  148.         virtual void    TurnOff();
  149.  
  150.         UInt32    mGroupIDPart1;
  151.         UInt32    mGroupIDPart2;
  152.     };
  153.  
  154. const UInt32 kNoGroupID = 0xFFFFFFFF;
  155.  
  156. //
  157. // AGATextStyle ---------------------------------------------------------------
  158. //
  159. // Many of the controls can have their text style specified. AGATextStyle
  160. // is used for this. It defines the font, size, and style to be used for
  161. // drawing text.
  162. //
  163.  
  164. class AGATextStyle
  165.     {
  166.     public:
  167.  
  168.         AGATextStyle();
  169.         AGATextStyle(SInt16 fontNum, SInt16 fontSize, Style fontStyle);
  170.         AGATextStyle(StringPtr fontName, SInt16 fontSize, Style fontStyle);
  171.         AGATextStyle(const TextStyle& textStyle);
  172.  
  173. #ifdef __PowerPlant__
  174.         AGATextStyle(ResIDT inTextTraitsID);
  175. #endif // __PowerPlant__
  176.         
  177.         void    PrepareForDrawing() const;
  178.  
  179.         SInt16    mFontNum;
  180.         SInt16    mFontSize;
  181.         Style    mFontStyle;
  182.     };
  183.  
  184. // These globals should be used in most cases. You can also roll your own.
  185. extern AGATextStyle gAGAStdSystemStyle;        // Typically Chicago 12. Standard.
  186. extern AGATextStyle gAGAStdSmallStyle;        // Typically Geneva 10. Slider labels.
  187. extern AGATextStyle gAGAExtraSmallStyle;    // Typically Geneva 9. Use where you need a small control.
  188.  
  189. //
  190. // AGAStaticText ---------------------------------------------------------------
  191. //
  192. // AGAStaticText draws a static text string on a gray background.
  193. //
  194.  
  195. class AGAStaticText : public AGAObject
  196.     {
  197.     public:
  198.  
  199.         AGAStaticText(Rect* bounds, const AGATextStyle& textStyle, SInt32 justification);
  200.         AGAStaticText(Rect* bounds, const AGATextStyle& textStyle, SInt32 justification, StringPtr title);
  201.         AGAStaticText(Rect* bounds, const AGATextStyle& textStyle, SInt32 justification, SInt16 stringListResourceID, SInt16 stringIndex);
  202.         virtual ~AGAStaticText();
  203.         
  204.         virtual void    DrawObject();
  205.  
  206.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  207.  
  208.     protected:
  209.  
  210.         SInt32            mJustification;
  211.         Str255            mTitle;
  212.         AGATextStyle    mTextStyle;
  213.     };
  214.  
  215. //
  216. // AGAPushButton ---------------------------------------------------------------
  217. //
  218. // AGAPushButton implements the standard AGA pushbutton. It automatically
  219. // draws the default button outline if you set its mIsDefault property
  220. // by calling SetDefault; you specify whether the outline is inside or
  221. // outside the object's mBounds.
  222. //
  223.  
  224. class AGAPushButton : public AGAObject
  225.     {
  226.     public:
  227.  
  228.         AGAPushButton(Rect* bounds, const AGATextStyle& textStyle);
  229.         AGAPushButton(Rect* bounds, const AGATextStyle& textStyle, StringPtr buttonTitle);
  230.         AGAPushButton(Rect* bounds, const AGATextStyle& textStyle, SInt16 stringListResourceID, SInt16 stringIndex);
  231.         virtual ~AGAPushButton();
  232.         
  233.         virtual void    DrawObject();
  234.  
  235.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  236.         
  237.         virtual void    SetDefault(Boolean isDefault, Boolean frameInside);
  238.  
  239.         void    DrawButton(Boolean pressed);
  240.         
  241.     protected:
  242.  
  243.         virtual Boolean    HitTest(Point mouseLocation);
  244.         virtual void    SetTrackingState(Boolean isIn);
  245.  
  246.         virtual void    DrawButtonNormal(Boolean deep);
  247.         virtual void    DrawButtonPressed(Boolean deep);
  248.         virtual void    DrawButtonDisabled(Boolean deep);
  249.         
  250.         void    DrawOutlineNormal(Boolean deep);
  251.         void    DrawOutlineDisabled(Boolean deep);
  252.  
  253.         Boolean            mIsDefault;        // if TRUE this button gets a default frame
  254.         Boolean            mFrameInside;    // if TRUE the frame is inside mBounds; else outside
  255.         Str255            mTitle;
  256.         AGATextStyle    mTextStyle;
  257.     };
  258.  
  259. //
  260. // AGACheckBox ---------------------------------------------------------------
  261. //
  262. // AGACheckBox implements the standard AGA check box. It also supports
  263. // a mixed state that is neither on nor off, which is drawn as a dash.
  264. //
  265.  
  266. class AGACheckBox : public AGAObject
  267.     {
  268.     public:
  269.  
  270.         enum { kCheckBoxSize = 12 };
  271.         enum { kCheckBoxOff = 0, kCheckBoxOn = 1, kCheckBoxMixed = 2 };
  272.  
  273.         AGACheckBox(Rect* bounds, const AGATextStyle& textStyle, Boolean automaticState);
  274.         AGACheckBox(Rect* bounds, const AGATextStyle& textStyle, StringPtr buttonTitle, Boolean automaticState);
  275.         AGACheckBox(Rect* bounds, const AGATextStyle& textStyle, SInt16 stringListResourceID, SInt16 stringIndex, Boolean automaticState);
  276.         virtual ~AGACheckBox();
  277.         
  278.         virtual void    DrawObject();
  279.         virtual Boolean    TrackMouse(Point mouseLocation);
  280.  
  281.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  282.         
  283.         virtual SInt32    GetValue();
  284.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  285.  
  286.         void    DrawButton(Boolean pressed);
  287.  
  288.     protected:
  289.  
  290.         virtual void    SetTrackingState(Boolean isIn);
  291.  
  292.         virtual void    DrawButtonNormal(Boolean deep);
  293.         virtual void    DrawButtonPressed(Boolean deep);
  294.         virtual void    DrawButtonDisabled(Boolean deep);
  295.         
  296.         SInt32            mValue;
  297.         Boolean            mAutomaticState;
  298.         Str255            mTitle;
  299.         AGATextStyle    mTextStyle;
  300.     };
  301.  
  302. //
  303. // AGAOffscreenImage ------------------------------------------------------------
  304. //
  305. // AGAOffscreenImage holds the data needed to blast a clipped region
  306. // of pixel values onto the current port. This is used by the AGARadioButton
  307. // class to avoid the ultra-tedious pixel-by-pixel drawing of the grayscale
  308. // radio button images.
  309. //
  310.  
  311. class AGAOffscreenImage
  312.  
  313. #ifdef AGA_SUPERCLASS
  314.     : public AGA_SUPERCLASS
  315. #endif // AGA_SUPERCLASS
  316.     {
  317.     public:
  318.     
  319.         AGAOffscreenImage();
  320.         virtual ~AGAOffscreenImage();
  321.         
  322.         virtual OSErr    CreateImageData(Point imageSize,
  323.                                 SInt8* imageColorIndexes,
  324.                                 RgnHandle clippingRegion);
  325.         
  326.         void    DrawImage(SInt16 imageHOrigin, SInt16 imageVOrigin);
  327.         void    DrawPattern(Rect* imageRect);
  328.  
  329.     protected:
  330.  
  331.         Rect            mImageSourceRect;    // 0, 0, x, y
  332.         PixMapHandle    mImagePixMap;
  333.         RgnHandle        mClippingRegion;
  334.     };
  335.  
  336. //
  337. // AGARadioButton ---------------------------------------------------------------
  338. //
  339. // AGARadioButton implements the standard AGA radio button. It also supports
  340. // a mixed state that is neither on nor off, which is drawn as a dash.
  341. // You can also assign an ID pair that will be used to automatically keep
  342. // the radio button mutually exclusive with others with the same ID pair.
  343. // Pass kNoGroupID for the IDs to bypass this.
  344. //
  345.  
  346. class AGARadioButton : public AGAObject, public MExclusiveObject
  347.     {
  348.     public:
  349.  
  350.         enum { kRadioButtonOff = 0, kRadioButtonOn = 1, kRadioButtonMixed = 2 };
  351.  
  352.         static OSErr AllocateRadioImages();
  353.         static void DisposeRadioImages();
  354.  
  355.         AGARadioButton(Rect* bounds, const AGATextStyle& textStyle, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  356.         AGARadioButton(Rect* bounds, const AGATextStyle& textStyle, StringPtr buttonTitle, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  357.         AGARadioButton(Rect* bounds, const AGATextStyle& textStyle, SInt16 stringListResourceID, SInt16 stringIndex, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  358.         virtual ~AGARadioButton();
  359.         
  360.         virtual void    DrawObject();
  361.         virtual Boolean    TrackMouse(Point mouseLocation);
  362.  
  363.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  364.         
  365.         virtual SInt32    GetValue();
  366.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  367.  
  368.         virtual void    TurnOff();    // MExclusiveObject override
  369.  
  370.         void    DrawButton(Boolean pressed);
  371.  
  372.     protected:
  373.  
  374.         virtual void    SetTrackingState(Boolean isIn);
  375.  
  376.         virtual void    DrawButtonNormal(Boolean deep);
  377.         virtual void    DrawButtonPressed(Boolean deep);
  378.         virtual void    DrawButtonDisabled(Boolean deep);
  379.         
  380.         void    CopyImage(UInt32 index);
  381.         
  382.         SInt32            mValue;
  383.         Boolean            mAutomaticState;
  384.         UInt32            mGroupID;
  385.         Str255            mTitle;
  386.         AGATextStyle    mTextStyle;
  387.         
  388.         // Drawing the 3D radio button manually is just too damn tedious.
  389.         // So we use offscreen PixMap structures and blast them onto the screen.
  390.         // The mask (clip) region for the images is a round rectangle.
  391.  
  392.         enum { kRadioImageWidth = 12, kRadioImageHeight = 12 };
  393.         enum { kRadioNormalOff, kRadioNormalOn, kRadioNormalMixed,
  394.                 kRadioPressedOff, kRadioPressedOn, kRadioPressedMixed,
  395.                 kRadioDisabledOff, kRadioDisabledOn, kRadioDisabledMixed,
  396.                 kNumRadioImages };
  397.         
  398.         static SInt8                kRadioImageValues[kNumRadioImages]
  399.                                                     [kRadioImageHeight]
  400.                                                     [kRadioImageWidth];
  401.  
  402.         static AGAOffscreenImage*    mgOffscreenRadioImages[kNumRadioImages];
  403.     };
  404.  
  405. //
  406. // MIconButtonObject ---------------------------------------------------------------
  407. //
  408. // MIconButtonObject is a mixin class for the classes that have an
  409. // icon button appearance. There are 3 different "types" of icon button,
  410. // differening only the details of the button edge appearance. The type
  411. // is determined by the button size, but you can explicitly set it with
  412. // the SetIconType function. An icon button has two icon IDs. Usually
  413. // these are the same, but for some button types you can make them
  414. // different. For example, if you want different icons for on/off when
  415. // the button is used as a radio button or check box.
  416. //
  417. // Ideal button sizes, to match AGA specification:
  418. // - Large icon button: 40x40 (32x32 iclx plus 4 pixel border on each side)
  419. // - Small icon button: 22x22 (16x16 icsx plus 3 pixel border on each side)
  420. // - Mini icon button:  16x16 (12x12 icmx plus 2 pixel border on each side)
  421. // Note that mini icons are a rather rare resource that ResEdit 2.x doesn't grok.
  422. //
  423.  
  424. class MIconButtonObject
  425.     {
  426.     public:
  427.  
  428.         enum { kNoIconID = 0 };
  429.         enum { kMiniIcon = 0, kSmallIcon = 1, kLargeIcon = 2 };
  430.  
  431.         MIconButtonObject();
  432.         MIconButtonObject(SInt16 offIconID, SInt16 onIconID, UInt32 iconType);
  433.         virtual ~MIconButtonObject();
  434.         
  435.         void    SetIconIDs(SInt16 offIconID, SInt16 onIconID);
  436.         void    SetIconType(UInt32 iconType);
  437.         
  438.         virtual void    DrawIconButton(Rect* bounds,
  439.                                         Boolean isOn,
  440.                                         Boolean isPressed,
  441.                                         Boolean isEnabled,
  442.                                         Boolean deep);
  443.  
  444.         static UInt32    GetDefaultIconType(SInt16 buttonWidth);
  445.  
  446.     protected:
  447.  
  448.         virtual void    DrawMiniEdges(Rect* bounds, Boolean isOn, Boolean isPressed, Boolean isEnabled, Boolean deep);
  449.         virtual void    DrawSmallEdges(Rect* bounds, Boolean isOn, Boolean isPressed, Boolean isEnabled, Boolean deep);
  450.         virtual void    DrawLargeEdges(Rect* bounds, Boolean isOn, Boolean isPressed, Boolean isEnabled, Boolean deep);
  451.  
  452.         SInt16    mOffIconID;
  453.         SInt16    mOnIconID;
  454.         UInt32    mIconType;
  455.     };
  456.  
  457. //
  458. // AGAIconPushButton ---------------------------------------------------------------
  459. //
  460. // AGAIconPushButton implements the standard AGA icon button, with
  461. // pushbutton behavior; that is to say, it has no state. This is
  462. // done by subclassing AGAPushButton for tracking, and mixing in
  463. // MIconButtonObject for drawing.
  464. //
  465.  
  466. class AGAIconPushButton : public AGAPushButton, public MIconButtonObject
  467.     {
  468.     public:
  469.  
  470.         AGAIconPushButton(Rect* bounds);
  471.         AGAIconPushButton(Rect* bounds, SInt16 iconID, UInt32 iconType);
  472.         virtual ~AGAIconPushButton();
  473.         
  474.     protected:
  475.  
  476.         virtual void    DrawButtonNormal(Boolean deep);
  477.         virtual void    DrawButtonPressed(Boolean deep);
  478.         virtual void    DrawButtonDisabled(Boolean deep);
  479.     };
  480.  
  481. //
  482. // AGAIconCheckBox ---------------------------------------------------------------
  483. //
  484. // AGAIconCheckBox implements the standard AGA icon button, with
  485. // check box behavior; that is to say, it has an on or off state
  486. // that toggles when hit. This is done by subclassing AGACheckBox
  487. // for tracking and state, and mixing in MIconButtonObject for drawing.
  488. //
  489.  
  490. class AGAIconCheckBox : public AGACheckBox, public MIconButtonObject
  491.     {
  492.     public:
  493.  
  494.         AGAIconCheckBox(Rect* bounds, Boolean automaticState);
  495.         AGAIconCheckBox(Rect* bounds, Boolean automaticState, SInt16 offIconID, SInt16 onIconID, UInt32 iconType);
  496.         virtual ~AGAIconCheckBox();
  497.         
  498.     protected:
  499.  
  500.         virtual void    DrawButtonNormal(Boolean deep);
  501.         virtual void    DrawButtonPressed(Boolean deep);
  502.         virtual void    DrawButtonDisabled(Boolean deep);
  503.     };
  504.  
  505. //
  506. // AGAIconRadioButton ---------------------------------------------------------------
  507. //
  508. // AGAIconRadioButton implements the standard AGA icon button, with
  509. // radio button behavior; that is to say, it has an on or off state
  510. // that can be automatically made mutually exclusive with other
  511. // buttons in its group. This is done by subclassing AGARadioButton
  512. // for tracking and state, and mixing in MIconButtonObject for drawing.
  513. //
  514.  
  515. class AGAIconRadioButton : public AGARadioButton, public MIconButtonObject
  516.     {
  517.     public:
  518.  
  519.         AGAIconRadioButton(Rect* bounds, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  520.         AGAIconRadioButton(Rect* bounds, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState, SInt16 offIconID, SInt16 onIconID, UInt32 iconType);
  521.         virtual ~AGAIconRadioButton();
  522.         
  523.     protected:
  524.  
  525.         virtual void    DrawButtonNormal(Boolean deep);
  526.         virtual void    DrawButtonPressed(Boolean deep);
  527.         virtual void    DrawButtonDisabled(Boolean deep);
  528.     };
  529.  
  530. class AGATrackingIndicator;
  531.  
  532. // This is the live tracking notification prototype for AGATrackingIndicator.
  533. typedef void (*AGATrackingIndicatorNotifyPtr)(AGATrackingIndicator* theIndicator, SInt32 itsNewValue, void* userData);
  534.  
  535. //
  536. // AGATrackingIndicator ---------------------------------------------------------------
  537. //
  538. // AGATrackingIndicator is the abstract superclass for things like
  539. // sliders and scroll bars that have a moving indicator to reflect
  540. // the object's position. It has a minimum/maximum range, a current
  541. // value, and optionally a page size for proportional indicator
  542. // display. You can turn live tracking on or off; if live tracking
  543. // is off, a "ghost" indicator is dragged and no notification occurs
  544. // until the tracking completes.
  545. //
  546.  
  547. class AGATrackingIndicator : public AGAObject
  548.     {
  549.     public:
  550.  
  551.         AGATrackingIndicator(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue);
  552.         AGATrackingIndicator(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, SInt32 pageSize, Boolean liveTracking, Boolean proportional);
  553.         virtual ~AGATrackingIndicator();
  554.         
  555.         virtual void    InstallNotificationRoutine(AGATrackingIndicatorNotifyPtr notificationRoutine, void* userData);
  556.         
  557.         virtual void    SetAttributes(Boolean isHorizontal, Boolean liveTracking, Boolean isProportional);
  558.  
  559.         virtual void    DrawObject();
  560.         virtual Boolean    TrackMouse(Point mouseLocation);
  561.         
  562.         virtual SInt32    GetValue();
  563.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  564.  
  565.         virtual void    GetRange(SInt32* minimum, SInt32* maximum);
  566.         virtual void    SetRange(SInt32 newMinimum, SInt32 newMaximum, Boolean redraw);
  567.         
  568.         virtual SInt32    GetPageSize();
  569.         virtual void    SetPageSize(SInt32 newPageSize, Boolean redraw);
  570.  
  571.     protected:
  572.  
  573.         enum { kNoTrackPress, kPageMinusPress, kArrowMinusPress, kIndicatorPress, kArrowPlusPress, kPagePlusPress };
  574.  
  575.         virtual Boolean    TrackPart(Point mouseLocation, SInt32 partHit);
  576.         virtual SInt32    TrackTestPart(Point mouseLocation);
  577.         virtual Boolean    IsValidIndicatorTrackMouse(Point mouseLocation);
  578.         virtual SInt32    GetValueFromMouseDelta(SInt32 originalValue, Point originalMouseLocation, Point newMouseLocation);
  579.         virtual void    SetGhostValue(SInt32 newValue, Boolean redraw);
  580.  
  581.         virtual void    DrawBackground();
  582.         virtual void    DrawIndicatorTrack();
  583.         virtual void    DrawTrackEnds();
  584.         virtual void    DrawIndicator();
  585.         virtual void    RemoveIndicator(SInt32 newValue);
  586.         virtual void    DrawGhost();
  587.         virtual void    RemoveGhost(SInt32 newValue);
  588.         
  589.         virtual void    NotifyValue();
  590.         
  591.         SInt32    mMinimum;
  592.         SInt32    mMaximum;
  593.         SInt32    mValue;
  594.         SInt32    mPageSize;
  595.         SInt32    mGhostValue;
  596.         Boolean    mLiveTracking;
  597.         Boolean    mIsProportional;
  598.         Boolean    mIsHorizontal;
  599.         Boolean    mIsPressed;
  600.         
  601.         AGATrackingIndicatorNotifyPtr    mNotificationRoutine;
  602.         void*                            mUserData;
  603.     };
  604.  
  605. //
  606. // AGAScrollBar ---------------------------------------------------------------
  607. //
  608. // AGAScrollBar implements the standard AGA scroll bar. It also supports
  609. // live indicator tracking and a proportional indicator as options.
  610. //
  611.  
  612. class AGAScrollBar : public AGATrackingIndicator
  613.     {
  614.     public:
  615.  
  616.         AGAScrollBar(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue);
  617.         AGAScrollBar(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, SInt32 singleStepSize, SInt32 pageStepSize, SInt32 pageSize, Boolean liveTracking, Boolean proportional);
  618.         virtual ~AGAScrollBar();
  619.  
  620.         virtual void    SetStepSizes(SInt32 singleStepSize, SInt32 pageStepSize);
  621.         virtual void    Activate(Boolean activateState, Boolean redraw);
  622.  
  623.     protected:
  624.  
  625.         virtual Boolean    TrackPart(Point mouseLocation, SInt32 partHit);
  626.         virtual SInt32    TrackTestPart(Point mouseLocation);
  627.         virtual Boolean    IsValidIndicatorTrackMouse(Point mouseLocation);
  628.         virtual SInt32    GetValueFromMouseDelta(SInt32 originalValue, Point originalMouseLocation, Point newMouseLocation);
  629.  
  630.         virtual void    DrawIndicatorTrack();
  631.         virtual void    DrawTrackEnds();
  632.         virtual void    DrawIndicator();
  633.         virtual void    RemoveIndicator(SInt32 newValue);
  634.         virtual void    DrawGhost();
  635.         virtual void    RemoveGhost(SInt32 newValue);
  636.         
  637.         virtual void    TrackDelta(SInt32 partHit);
  638.  
  639.         virtual void    DrawArrow(SInt32 arrowPart, Boolean pressed);
  640.         
  641.         enum { kIndicatorPixelInset = 8 };
  642.         enum { kArrowSize = 16 };
  643.  
  644.         virtual void    GetIndicatorBox(SInt32 value, Rect* indicatorBox);
  645.         virtual SInt32    GetIndicatorPixelRange(SInt32* proportionalIndicatorPixels);
  646.         virtual void    GetIndicatorPixelEnds(SInt32* startPt, SInt32* stopPt);
  647.         virtual void    GetIndicatorSpan(SInt32 value, SInt32* startPt, SInt32* valuePt, SInt32* stopPt);
  648.         
  649.         SInt32    mSingleStepSize;    // amount to delta for arrow tracking
  650.         SInt32    mPageStepSize;        // amount to delta for page tracking
  651.         Boolean    mActive;            // inactive windows have inactive scroll bars
  652.         
  653.         // These regions are used by RemoveIndicator and RemoveGhost.
  654.         // They are tiny but we allocate them statically to avoid
  655.         // repeated allocation, which could conceivably fail.
  656.         static RgnHandle    mgSavedIndicatorClip;
  657.         static RgnHandle    mgOldIndicatorClip;
  658.         static RgnHandle    mgNewIndicatorClip;
  659.     };
  660.  
  661. //
  662. // AGASlider ---------------------------------------------------------------
  663. //
  664. // AGASlider implements the standard AGA slider. You specify whether it
  665. // is horizontal or vertical, labeled or unlabeled, rectangular or pointy.
  666. // By default, if you specify a labeled slider, it is pointy; otherwise it
  667. // is rectangular. You can change this by calling SetSliderKind, and you
  668. // can set the labels up after construction by calling the label functions.
  669. // It also supports live indicator tracking and a proportional indicator
  670. // as options.
  671. //
  672.  
  673. class AGASlider : public AGATrackingIndicator
  674.     {
  675.     public:
  676.  
  677.         enum SliderKind { kRectSlider, kPointerSlider };
  678.  
  679.         AGASlider(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, const AGATextStyle& textStyle, SInt16 labelsID);
  680.         AGASlider(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, const AGATextStyle& textStyle, SInt16 labelsID, SliderKind kind, Boolean liveTracking, Boolean proportional);
  681.         virtual ~AGASlider();
  682.         
  683.         virtual void    SetSliderKind(SliderKind kind);
  684.         virtual void    SetLabelsFromResource(SInt16 stringListResourceID);
  685.         virtual void    SetNumLabels(UInt32 numLabels);
  686.         virtual void    SetLabel(UInt32 labelIndex, StringPtr itsLabel);
  687.         virtual void    GetLabel(UInt32 labelIndex, StringPtr itsLabel);
  688.         virtual void    SetLabelsStyle(const AGATextStyle& textStyle);
  689.         virtual void    SetJustification(SInt32 justification);
  690.  
  691.     protected:
  692.  
  693.         virtual SInt32    TrackTestPart(Point mouseLocation);
  694.         virtual Boolean    IsValidIndicatorTrackMouse(Point mouseLocation);
  695.         virtual SInt32    GetValueFromMouseDelta(SInt32 originalValue, Point originalMouseLocation, Point newMouseLocation);
  696.  
  697.         virtual void    DrawBackground();
  698.         virtual void    DrawIndicatorTrack();
  699.         virtual void    DrawIndicator();
  700.         virtual void    RemoveIndicator(SInt32 newValue);
  701.         virtual void    DrawGhost();
  702.         virtual void    RemoveGhost(SInt32 newValue);
  703.         
  704.         enum { kRectIndicatorPixelInset = 6 };
  705.         enum { kPointerIndicatorPixelInset = 7 };
  706.         enum { kIndicatorWidth = 16 };
  707.         enum { kEndGapSize = 5 };
  708.         enum { kLabelTickEndInset = 11};
  709.         enum { kLabelTickOffset = 8};
  710.         enum { kLabelPosTextOffset = 14};
  711.         enum { kLabelNegTextOffset = 8};
  712.         enum { kLabelTickLength = 6};
  713.         enum { kGhostIndicator = TRUE, kNormalIndicator = FALSE };
  714.         enum { kIncludeBackground = TRUE, kTrackOnly = FALSE };
  715.  
  716.         virtual void    GetTrackFrame(Rect* trackFrame, Boolean includeBackground);
  717.         virtual void    GetIndicatorBox(SInt32 value, Rect* indicatorBox);
  718.         virtual SInt32    GetIndicatorPixelRange(SInt32* proportionalIndicatorPixels);
  719.         virtual void    GetIndicatorPixelEnds(SInt32* startPt, SInt32* stopPt);
  720.         virtual void    GetIndicatorSpan(SInt32 value, SInt32* startPt, SInt32* valuePt, SInt32* stopPt);
  721.         
  722.         virtual void    DrawLabels();
  723.         virtual void    DrawRectIndicator(Rect* indicatorRect, Boolean isGhost);
  724.         virtual void    DrawPointerIndicator(Rect* indicatorRect, Boolean isGhost);
  725.         virtual void    BuildPointerIndicator(Rect* indicatorRect);
  726.         
  727.         virtual void    DisposeLabels();
  728.         
  729.         Handle            mLabelStringHandles;    // an array of StringHandle, may be NULL
  730.         SInt32            mJustification;
  731.         SliderKind        mSliderKind;
  732.         AGATextStyle    mTextStyle;
  733.         
  734.         // These regions are used by RemoveIndicator and RemoveGhost.
  735.         // They are tiny but we allocate them statically to avoid
  736.         // repeated allocation, which could conceivably fail.
  737.         static RgnHandle    mgSavedIndicatorClip;
  738.         static RgnHandle    mgOldIndicatorClip;
  739.         static RgnHandle    mgNewIndicatorClip;
  740.     };
  741.  
  742. //
  743. // AGAPopupMenu ---------------------------------------------------------------
  744. //
  745. // AGAPopupMenu implements the standard AGA pop-up menu. You can specify
  746. // whether the supplied boundary is fixed or whether the pop-up button
  747. // should adapt its width to the width of the associated menu. You can
  748. // also supply a title to be drawn next to the pop-up button.
  749. //
  750.  
  751. class AGAPopupMenu : public AGAObject
  752.     {
  753.     public:
  754.  
  755.         enum WidthAdjust { kFixedWidth = -1, kUseMenuWidth = 0, kSystemMDEFAdjustment = 19 };
  756.         enum DisposalKind { kDontDispose, kDispose, kRelease };
  757.  
  758.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& textStyle, WidthAdjust adjustment);
  759.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& textStyle, WidthAdjust adjustment, MenuRef itsMenuRef, DisposalKind menuRefDisposalKind);
  760.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& textStyle, WidthAdjust adjustment, SInt16 itemsStringListID, SInt16 newMenuID);
  761.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& textStyle, WidthAdjust adjustment, ResType appendResourceType, SInt16 newMenuID);
  762.         virtual ~AGAPopupMenu();
  763.         
  764.         virtual void    SetMenuRef(MenuRef itsMenuRef, DisposalKind menuRefDisposalKind);
  765.         virtual void    SetWidthAdjustment(WidthAdjust adjustment);
  766.         
  767.         virtual void    DrawObject();
  768.         virtual Boolean    TrackMouse(Point mouseLocation);
  769.  
  770.         virtual SInt16    GetCurrentItemNo();
  771.         virtual void    SetCurrentItemNo(SInt16 newItemNo, Boolean redraw);
  772.         
  773.         virtual void    GetCurrentItemText(StringPtr itemText);
  774.         virtual Boolean    SetCurrentItemText(StringPtr itemTextToMatch, Boolean redraw);    // returns FALSE if no match found
  775.  
  776.         void    DrawButton(Boolean pressed);
  777.  
  778.     protected:
  779.  
  780.         virtual void    DrawButtonNormal(Boolean deep);
  781.         virtual void    DrawButtonPressed(Boolean deep);
  782.         virtual void    DrawButtonDisabled(Boolean deep);
  783.         virtual void    GetButtonBounds(Rect* buttonBounds);
  784.         virtual void    GetTitleBounds(Rect* titleBounds);
  785.         
  786.         virtual void    DisposeExistingMenuRef();
  787.         
  788.         enum { kPopupArrowSectionWidth = 22 };
  789.  
  790.         SInt16            mMenuID;
  791.         MenuRef            mMenuRef;
  792.         DisposalKind    mMenuRefDisposalKind;
  793.         SInt16            mCurrentItemNo;
  794.         WidthAdjust        mWidthAdjust;
  795.         AGATextStyle    mTextStyle;
  796.         Str255            mTitle;
  797.         SInt16            mTitleOffset;
  798.         SInt32            mTitleJustification;
  799.     };
  800.  
  801. class AGALittleArrows;
  802.  
  803. // This is the live tracking notification prototype for AGALittleArrows.
  804. typedef void (*AGALittleArrowsNotifyPtr)(AGALittleArrows* theIndicator, SInt32 pressedPart, void* userData);
  805.  
  806. //
  807. // AGALittleArrows ---------------------------------------------------------------
  808. //
  809. // AGALittleArrows implements the standard AGA little arrows. To respond
  810. // to continuous messages during tracking, you should either install a
  811. // notification routine or subclass and override NotifyDelta. The supplied
  812. // MacApp and PowerPlant classes do this for you.
  813. //
  814.  
  815. class AGALittleArrows : public AGAObject
  816.     {
  817.     public:
  818.  
  819.         enum { kDownArrowPressed = -1, kNoArrowPressed = 0, kUpArrowPressed = 1 };
  820.  
  821.         AGALittleArrows(Rect* bounds);
  822.         virtual ~AGALittleArrows();
  823.         
  824.         virtual void    InstallNotificationRoutine(AGALittleArrowsNotifyPtr notificationRoutine, void* userData);
  825.         
  826.         virtual void    DrawObject();
  827.         virtual Boolean    TrackMouse(Point mouseLocation);
  828.  
  829.         void    DrawButton(SInt32 pressedPart);
  830.         
  831.     protected:
  832.  
  833.         enum { kLittleArrowWidth = 13, kLittleArrowHeight = 12, kLittleArrowTotalHeight = 23 };
  834.  
  835.         virtual Boolean    TrackPart(Point mouseLocation, SInt32 partHit);
  836.         virtual SInt32    TrackTestPart(Point mouseLocation);
  837.  
  838.         virtual void    NotifyDelta(SInt32 partHit);
  839.         
  840.         AGALittleArrowsNotifyPtr    mNotificationRoutine;
  841.         void*                        mUserData;
  842.     };
  843.  
  844. //
  845. // AGADisclosureTriangle ---------------------------------------------------------------
  846. //
  847. // AGADisclosureTriangle implements the standard AGA disclosure triangle.
  848. // You can think of it as a check box that is either off (closed) or on
  849. // (disclosed).
  850. //
  851.  
  852. class AGADisclosureTriangle : public AGAObject
  853.     {
  854.     public:
  855.  
  856.         enum { kDisclosedState = TRUE, kClosedState = FALSE };
  857.  
  858.         AGADisclosureTriangle(Rect* bounds, Boolean automaticState);
  859.         virtual ~AGADisclosureTriangle();
  860.         
  861.         virtual void    DrawObject();
  862.         virtual Boolean    TrackMouse(Point mouseLocation);
  863.         
  864.         virtual Boolean    GetState();
  865.         virtual void    SetState(Boolean isDisclosed, Boolean redraw);
  866.         virtual void    SetStateAnimate(Boolean isDisclosed);
  867.  
  868.     protected:
  869.  
  870.         virtual void    SetTrackingState(Boolean isIn);
  871.  
  872.         enum DTAnimationState { kDTClosed, kDTPressedClosed, kDTIntermediate, kDTPressedDisclosed, kDTDisclosed };
  873.  
  874.         void    DrawTriangle(DTAnimationState state);
  875.         void    EraseBackground();
  876.  
  877.         Boolean        mAutomaticState;
  878.         Boolean        mIsDisclosed;
  879.     };
  880.  
  881. //
  882. // AGAProgressIndicator ---------------------------------------------------------------
  883. //
  884. // AGAProgressIndicator implements the standard AGA progress indicator.
  885. // It can be determinate (a moving gauge) or indeterminate (a rotating
  886. // barber pole). In addition, it supports a "moving origin", which is
  887. // where, in addition to moving the gauge end point, the gauge start
  888. // point also moves.
  889. //
  890.  
  891. class AGAProgressIndicator : public AGAObject
  892.     {
  893.     public:
  894.  
  895.         static OSErr AllocateProgressImages();
  896.         static void DisposeProgressImages();
  897.  
  898.         AGAProgressIndicator(Rect* bounds, SInt32 minimum, SInt32 maximum);
  899.         virtual ~AGAProgressIndicator();
  900.         
  901.         virtual void    DrawObject();
  902.         
  903.         virtual SInt32    GetValue();
  904.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  905.         virtual void    Increment(SInt32 delta, Boolean redraw);
  906.         
  907.         virtual void    Animate();
  908.         
  909.         virtual void    GetRange(SInt32* minimum, SInt32* maximum);
  910.         virtual void    SetRange(SInt32 newMinimum, SInt32 newMaximum, Boolean redraw);
  911.         
  912.         virtual SInt32    GetOriginValue();
  913.         virtual void    SetOriginValue(SInt32 newValue, Boolean redraw);
  914.  
  915.     protected:
  916.  
  917.         virtual void    DrawFrame();
  918.         virtual void    DrawAnimationStep();
  919.         virtual void    DrawGauge();
  920.         virtual void    DrawOriginArea();
  921.         virtual void    DrawProgressArea();
  922.         virtual void    DrawRemainderArea();
  923.         
  924.         virtual Boolean    GetOriginFrame(Rect* originFrame);
  925.         virtual Boolean    GetProgressFrame(Rect* progressFrame);
  926.         virtual Boolean    GetRemainderFrame(Rect* remainderFrame);
  927.         virtual void    GetRangeFrame(SInt32 startValue, SInt32 endValue, Rect* rangeFrame);
  928.  
  929.         enum { kProgressHeight = 14 };
  930.         enum { kProgressImageHeight = 10, kProgressImageWidth = 16 };
  931.         enum { k1BitPattern, kDeepPattern, kNumProgressPatterns };
  932.         enum { kNumProgressAnimationSteps = 4 };    // 2, 4, 8, or 16 will work
  933.  
  934.         SInt32        mMinimum;
  935.         SInt32        mMaximum;
  936.         SInt32        mValue;
  937.         SInt32        mOriginValue;    // usually == mMinimum
  938.         UInt32        mAnimationIndex;
  939.  
  940.         static SInt8                kIndeterminateProgressImage[kNumProgressPatterns]
  941.                                                                 [kProgressImageHeight]
  942.                                                                 [kProgressImageWidth];
  943.  
  944.         static AGAOffscreenImage*    mgOffscreenIndeterminateProgressImage[kNumProgressPatterns];
  945.     };
  946.  
  947. //
  948. // AGASeparator ---------------------------------------------------------------
  949. //
  950. // AGASeparator implements the standard AGA separator line.
  951. // It automatically determines its orientation based on the coordinate
  952. // bounding box dimensions.
  953. //
  954.  
  955. class AGASeparator : public AGAObject
  956.     {
  957.     public:
  958.  
  959.         AGASeparator(Rect* bounds);
  960.         virtual ~AGASeparator();
  961.         
  962.         virtual void    DrawObject();
  963.     };
  964.  
  965. //
  966. // AGAGroupBox ---------------------------------------------------------------
  967. //
  968. // AGAGroupBox implements the standard AGA group box. A group box
  969. // can either be primary or secondary. Secondary group boxes should
  970. // be used inside primary group boxes. You can supply a title string
  971. // for the group box, or you can specify a "gap" width that is to
  972. // be left blank to make room for a control or title string that will
  973. // be drawn elsewhere.
  974. //
  975.  
  976. class AGAGroupBox : public AGAObject
  977.     {
  978.     public:
  979.  
  980.         enum { kPrimaryGroupBox = TRUE, kSecondaryGroupBox = FALSE };
  981.  
  982.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType);
  983.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType, SInt16 titleGap);
  984.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType, StringPtr titleString);
  985.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType, SInt16 titleStringListResourceID, SInt16 titleStringIndex);
  986.         virtual ~AGAGroupBox();
  987.         
  988.         virtual void    SetTitleGap(SInt16 titleGap);
  989.         virtual void    SetTitle(StringPtr newTitle, Boolean redraw);
  990.         
  991.         virtual void    DrawObject();
  992.  
  993.     protected:
  994.  
  995.         virtual void    DrawPrimaryFrame(SInt16 topIndent, SInt16 gapSize);
  996.         virtual void    DrawSecondaryFrame(SInt16 topIndent, SInt16 gapSize);
  997.  
  998.         Boolean            mIsPrimaryBox;
  999.         SInt16            mTitleGap;    // horizontal gap for other object in title, no top indent
  1000.         Str255            mTitle;        // zero-length string indicates no title, no top indent
  1001.         AGATextStyle    mTextStyle;
  1002.     };
  1003.  
  1004. //
  1005. // GDIterator -----------------------------------------------------
  1006. //
  1007. // To properly handle drawing in grayscale with multiple monitors
  1008. // and differing color depths, we must draw while iterating over
  1009. // the GD handles. This iterator makes a for loop easy while also
  1010. // reducing the clipping area to the appropriate device and setting
  1011. // a boolean to indicate whether the device is "deep" or not. "Deep"
  1012. // meaning suitable for grayscale drawing as opposed to black & white.
  1013. //
  1014.  
  1015. class GDIterator
  1016.     {
  1017.     public:
  1018.     
  1019.         GDIterator();
  1020.         virtual ~GDIterator();
  1021.         
  1022.         void    Setup();            // called by constructor; can be called again
  1023.         Boolean    More(Boolean& deep);// returns true while you should draw again
  1024.         void    Cleanup();            // called by destructor; can be called earlier
  1025.         
  1026.         void    ClipFurtherToCurrentDevice();    // can be called for tricky clipping situations (see slider labels)
  1027.  
  1028.     protected:
  1029.     
  1030.         GDHandle    FindNextValidDevice(GDHandle currentDevice, Boolean& deep);
  1031.         void        ClipFurtherToDevice(GDHandle aDevice);
  1032.  
  1033.         Boolean        mIteratedYet;
  1034.         GDHandle    mCurrentGDHandle;    // inited by Setup, changed by More
  1035.  
  1036.         static RgnHandle    mSavedClipping;        // saved by Setup, restored by Cleanup
  1037.     };
  1038.  
  1039. //
  1040. // AGAGroupsContainer --------------------------------------------------------
  1041. //
  1042. // This class is used internally to maintain the MExclusiveObject
  1043. // behavior that allows radio buttons to automatically maintain
  1044. // standard radio button group XOR behavior.
  1045. //
  1046.  
  1047. typedef struct
  1048.     {
  1049.     UInt32                        mGroupIDPart1;
  1050.     UInt32                        mGroupIDPart2;
  1051.     vector<MExclusiveObject*>    mGroupMembers;
  1052.     } AGAGroup;
  1053.  
  1054. class AGAGroupsContainer
  1055.  
  1056. #ifdef AGA_SUPERCLASS
  1057.     : public AGA_SUPERCLASS
  1058. #endif // AGA_SUPERCLASS
  1059.  
  1060.     {
  1061.     public:
  1062.  
  1063.         void    AGAAddGroupMember(MExclusiveObject* groupMember);
  1064.         void    AGARemoveGroupMember(MExclusiveObject* groupMember);
  1065.         void    AGAHitGroupMember(MExclusiveObject* groupMember);
  1066.  
  1067.     protected:
  1068.  
  1069.         AGAGroup*            FindGroup(MExclusiveObject* groupMember);
  1070.         MExclusiveObject**    FindMemberPtr(AGAGroup* itsGroup, MExclusiveObject* groupMember);
  1071.  
  1072.         vector<AGAGroup>    mGroups;
  1073.     };
  1074.  
  1075. //
  1076. // These are the gAGARamp RGB color value indexes.
  1077. // They match the numbers specified in the AGA doc.
  1078. // rW is white.
  1079. // 1 thru 12 go from light gray to dark gray, matching AGA doc indexes.
  1080. // rA is the additional dark gray in the indeterminate progress pattern.
  1081. // rB is black.
  1082. // rA1 thru rA4 are the purple shades for the disclosure triangle.
  1083. //
  1084.  
  1085. typedef enum
  1086.     {
  1087.     rW = 0,
  1088.     r1 = 1,
  1089.     r2 = 2,
  1090.     r3 = 3,
  1091.     r4 = 4,
  1092.     r5 = 5,
  1093.     r6 = 6,
  1094.     r7 = 7,
  1095.     r8 = 8,
  1096.     r9 = 9,
  1097.     r10 = 10,
  1098.     r11 = 11,
  1099.     r12 = 12,
  1100.     rA = 13,
  1101.     rB = 14,
  1102.     rA1 = 15,
  1103.     rA2 = 16,
  1104.     rA3 = 17,
  1105.     rA4 = 18,
  1106.     
  1107.     kNumRampColors,
  1108.     
  1109.     OUT = -1
  1110.     } RampIndex;
  1111.  
  1112. extern RGBColor    gAGARamp[kNumRampColors];
  1113. extern Boolean    gAGAHasColorQD;
  1114. extern const Str255 gGrayCouncilCopyright;
  1115.  
  1116. extern void SetGrayCouncilDefault(UInt32 itemMask, Boolean turnOn);
  1117. extern Boolean TestGrayCouncilDefault(UInt32 itemMask);
  1118.  
  1119. #define kAGALiveScrolling            0x00000001
  1120. #define kAGAProportionalScrolling    0x00000002
  1121. #define kAGALiveRSliders            0x00000004
  1122. #define kAGAProportionalRSliders    0x00000008
  1123. #define kAGALivePSliders            0x00000010
  1124. #define kAGAProportionalPSliders    0x00000020
  1125.  
  1126. #define kNoTruncation -1
  1127.  
  1128. enum AGAStringOutColor { kNormalOutput, kDisabledOutput, kInverseOutput, kUseCurrentColor };
  1129.  
  1130. extern void AGAStringOut(StringPtr aString,
  1131.                         Rect* centeringFrame,
  1132.                         SInt32 truncation,
  1133.                         SInt32 justification,
  1134.                         AGAStringOutColor outColor,
  1135.                         Boolean deep,
  1136.                         const AGATextStyle& textStyle);
  1137.  
  1138. enum { kIsModal = TRUE, kIsNotModal = FALSE };
  1139. extern void AGABackgroundPaint(const Rect* backgroundBounds,
  1140.                                 Boolean drawFill,
  1141.                                 Boolean isModal,
  1142.                                 Boolean isActive,
  1143.                                 Boolean hasGrowBox);
  1144.  
  1145. extern void AGAClipFurther(Rect* clippingRect);
  1146. extern void CleansePen();
  1147.  
  1148. #endif // __GRAYCOUNCIL__
  1149.  
  1150.